package com.job.dao;

import com.job.pojo.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserInfoDao {

    //登录 验证账号和密码是否匹配
    @Select("select * from userdata where userName=#{userName} and userPwd=#{userPwd}")
    UserInfo login(UserInfo user);


    @Insert("insert into userdata (userName,userPwd,salt) value (#{userName},#{userPwd},#{salt})")
    int zhuce(UserInfo user);


    //验证用户名是否重名
    @Select("select count(*) from userdata where userName=#{userName}")
    int verifyName(UserInfo user);

    //查询用户名是否存在，并且取出盐值
    @Select("select * from userdata where userName=#{userName}")
    UserInfo selectByName(UserInfo user);

    //修改密码
    @Update("update userdata set userPwd=#{userPwd} where userId=#{userId}")
    int ChangePass(UserInfo user);

}
